package cn.youyeku.zsxh.ui.home;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;

import cn.youyeku.zsxh.R;
import cn.youyeku.zsxh.api.XhApi;
import cn.youyeku.zsxh.app;
import cn.youyeku.zsxh.ui.activity.ABS.BaseActivity;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;

/**
 * Created by youye on 17-4-12.
 */

public class UnActive extends BaseActivity implements View.OnClickListener {


    /**
     * user_register_click_resend
     */
    private Button mRegisterResend;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.act_show);
        initView();

    }

    private void initView() {
        mRegisterResend = (Button) findViewById(R.id.register_resend);
        mRegisterResend.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.register_resend:
                XhApi.resend(new Callback() {
                    @Override
                    public void onFailure(Call call, IOException e) {

                    }

                    @Override
                    public void onResponse(Call call, Response response) throws IOException {
                        try {
                            JSONObject object = new JSONObject(response.body().string());
                            app.backgroundThreadShortToast(object.getString("message"));
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }

                    }
                });
                break;
        }
    }
}
